<html>
<head><h2>Registration - It's easy!</h2>
<script type="text/javascript">

function check(){
	var e = document.getElementById("try");
	var month = e.options[e.selectedIndex].value;
	//document.write(month);
	day = document.getElementById("try2");
	limit = day.options.length;
	if (month == "feb"){
		if (limit == 30){
			//do nothing
		}
		else{
			/*
			for(i = 28; i <= limit; i++){
				optn = document.createElement("OPTION");
				option.text = i;
				option.value = i;
				day.options.add(optn);
			}*/
			while (limit != 30){
				day.remove(limit-1);
				limit =  day.options.length;
				//alert(limit);
			}
		}
	}
	else if (month == "jan" || month == "mar" || month == "may" || month == "july" || month == "august" || month == "oct" || month == "dec"){
		if (limit == 32){//31 days
		}
		else {
			while(limit < 32){
				//alert(limit);
				optn = document.createElement("option");
				optn.text = limit;
				optn.value = limit;
				day.options.add(optn);
				limit = day.options.length;
			}
		}
	}
	else{
		if (limit == 31){
		}
		else if (limit > 31){
			day.remove(31);
		}
		else{
			while(limit < 31){
				//alert(limit);
				optn = document.createElement("option");
				optn.text = limit;
				optn.value = limit;
				day.options.add(optn);
				limit = day.options.length;			
			}
		}
	}
}
</script>
<title></title>
</head>
<body>
<?php echo $this->validation->error_string; ?>
<?php if(isset($error)) echo "<p>$error</p>"; ?>
<br />
<?php echo form_open('gate/register', array('class'=>'reg')); ?>
First Name: <br /><input type = "text" name = "firstname" size = "30" value= "<?php echo $this->validation->firstname ?>"/><br />
Middle Name (optional): <br /><input type = "text" name = "middlename" size = "30" value= "<?php echo $this->validation->middlename ?>"/><br />
Last Name: <br /><input type = "text" name = "lastname" size = "30" value= "<?php echo $this->validation->lastname ?>"/><br />
E-mail: <br /><input type=text  class = "generic_input" name = "email" size = "30" value= "<?php echo $this->validation->email ?>"/><br />
Re-enter e-mail: <br /><input type = "text" class = "generic_input" name = "email_conf" size = "30" /><br />
Choose a password: <br /><input type = "password"  class="generic_input" name = "password" size = "30" /><br />
Re-enter password: <br /><input type = "password"  class="generic_input" name = "password_conf" size = "30" /><br /><br />
I am: <input type = "radio" name = "gender" value = "male" <?php echo set_radio('gender', 'male', TRUE); ?> /> Male <input type = "radio" name = "gender" value = "female" <?php echo set_radio('gender', 'female'); ?> /> Female<br /><br />

Birthday :
<select id = "try" name="month" onchange="check()">
<option> Month: </option>
<option value="jan">January</option>
<option value="feb">February</option>
<option value="mar">March</option>
<option value="april">April</option>
<option value="may">May</option>
<option value="june">June</option>
<option value="july">July</option>
<option value="august">August</option>
<option value="sept">September</option>
<option value="oct">October</option>
<option value="nov">November</option>
<option value="dec">December</option>
</select>

<select id = "try2" name="day">
<option> Day: </option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
 </select>

<select name="year">
<option> Year: </option>
<?php
	$year = (int)date('Y');
	for($i = $year; $i>1900; $i--){
		//echo "<option "."value='$i'".">".$i."</option>";
		echo "<option ";
		echo "value=$i";
		echo ">";
		echo $i;
		echo "</option>";
	}
?>
</select><br /><br />
<?php echo form_submit(array('class' => 'reg', 'value' => 'Register')); ?><?php echo "        ";?>
<?php echo form_reset(array('class' => 'reg', 'value' => 'Reset')); ?>
<?php echo form_close(); ?>
</body>
</html>
